using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using jQueryApi;

namespace Nsb.Classes
{
    public delegate bool BoolAddDelegate(jQueryObject el, string prop, string value);

    [IgnoreNamespace]
    public class DDict
    {
        private readonly Dictionary _dict = new Dictionary();

        [AlternateSignature]
        public extern DDict Add(string key, Action dj);

        [AlternateSignature]
        public extern DDict Add(string key, Action<jQueryEvent> dj);

        [AlternateSignature]
        public extern DDict Add(string key, Action<jQueryEvent, string> dj);

        [AlternateSignature]
        public extern DDict Add(string key, BoolAddDelegate dj);

        public DDict Add(string key, object dj)
        {
            _dict[key] = dj;
            return this;
        }

        public Dictionary End()
        {
            return _dict;
        }
    }

    [IgnoreNamespace]
    public class DList
    {
        private readonly List<object> _list = new List<object>();

        public DList Add(object dj)
        {
            _list.Add(dj);
            return this;
        }

        public List<object> End()
        {
            return _list;
        }
    }
}